-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reproduce MySQL warnings with and without emulated prepares #6522
Reproduce MySQL warnings with and without emulated prepares #6522
Conversation
Signed-off-by: Luís Cobucci <[email protected]>
6006dc1
to
42ee7bc
Compare
use function hex2bin; | ||
|
||
/** @psalm-import-type WrapperParameterTypeArray from Connection */ | ||
final class MySQLWarningsWithBinaryTest extends FunctionalTestCase |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After running things locally, this will need to be handled upstream (PDO MySQL), given it only happens when the prepared statement emulation is enabled.
So I see that there is a 2⨉2⨉2 matrix of parameters:
Observations:
This syntax error could be reduced to:
I didn't dig much into the documentation but I wouldn't expect this to be in invalid syntax. Note that this works:
Which means that likely an introducer cannot be used in prepared statements. That's why it works only with emulation. |
Thank you for digging into this. The introducer is just the workaround to avoid the warning when not using real prepared statements. Given the removal of the emulation layer leads us to the usage of the binary protocol, things just work as expected. This reinforces the feeling of something that needs to be addressed in the PDO driver. That way, the introducer can be automatically added when the right parameter hint is specified. |
Got it. So in this case, we want to focus just on one of the 4 items from the data provider: dbal/tests/Functional/Platform/MySQLWarningsWithBinaryTest.php Lines 75 to 78 in 42ee7bc
We can configure MySQL to log all queries and query them: SET GLOBAL general_log = 'ON';
SET GLOBAL log_output = 'table';
SELECT * FROM mysql.general_log; The queries with and without emulation look like this:
I don't know how relevant this difference in string representation of binary data is, but it is in a few This is definitely a PDO/emulation problem. This test can be easily reworked to not use the DBAL at all and yield the same results. |
Shall we report this to PHP before we consider implementing workarounds on our side? |
This is definitely to be reported to PHP. As for implementing a workaround, I'm not that eager (I don't mind if anybody wants to). However, historically, we deliberately didn't work around 3rd party issues in the DBAL. I didn't check the correctness aspect of this issue, but if it's only a warning, then the DBAL/PDO users can ignore it until it's fixed. |
I fully agree that we shouldn't have a workaround for this in DBAL. I'll do some investigation around PDO's emulation layer (it does trigger some I'll close this PR too. |
The prepared statement emulation layer is handling binary content in a way that creates warnings in MySQL. When analysing the query logs, we saw that the content sent to the server is missing `0x5C` characters when the using emulated prepares. This introduces a minimal test case that reproduces the issue to aid the solution. More info: doctrine/dbal#6522 (comment) Signed-off-by: Luís Cobucci <[email protected]>
The prepared statement emulation layer is handling binary content in a way that creates warnings in MySQL. When analysing the query logs, we saw that the content sent to the server is missing `0x5C` characters when the using emulated prepares. This introduces a minimal test case that reproduces the issue to aid the solution. More info: doctrine/dbal#6522 (comment) Signed-off-by: Luís Cobucci <[email protected]>
The prepared statement emulation layer is handling binary content in a way that creates warnings in MySQL. When analysing the query logs, we saw that the content sent to the server is missing `0x5C` characters when the using emulated prepares. This introduces a minimal test case that reproduces the issue to aid the solution. More info: doctrine/dbal#6522 (comment) Signed-off-by: Luís Cobucci <[email protected]>
The prepared statement emulation layer is handling binary content in a way that creates warnings in MySQL. When analysing the query logs, we saw that the content sent to the server is missing `0x5C` characters when the using emulated prepares. This introduces a minimal test case that reproduces the issue to aid the solution. More info: doctrine/dbal#6522 (comment) Signed-off-by: Luís Cobucci <[email protected]>
The prepared statement emulation layer is handling binary content in a way that creates warnings in MySQL. When analysing the query logs, we saw that the content sent to the server is missing `0x5C` characters when the using emulated prepares. This introduces a minimal test case that reproduces the issue to aid the solution. More info: doctrine/dbal#6522 (comment) Signed-off-by: Luís Cobucci <[email protected]>
This highlights MySQL warnings when dealing with binary data